<template>
  <div id="index" ref="appRef">
    <div class="bg">
      <dv-loading v-if="loading">Loading...</dv-loading>
      <div v-else class="host-body">
        <!-- 第一行 -->
        <div class="d-flex jc-center">
          <dv-decoration-10 class="dv-dec-10" />
          <div class="d-flex jc-center">
            <dv-decoration-8 class="dv-dec-8" :color="decorationColor" />
            <div class="title">
              <span class="title-text">卓创优质管理平台 </span>
              <dv-decoration-6
                class="dv-dec-6"
                :reverse="true"
                :color="['#50e3c2', '#67a1e5']"
              />
            </div>
            <dv-decoration-8
              class="dv-dec-8"
              :reverse="true"
              :color="decorationColor"
            />
          </div>
          <dv-decoration-10 class="dv-dec-10-s" />
        </div>

        <!-- 第二行 -->
        <div class="d-flex jc-between px-2">
          <div class="d-flex aside-width">
            <div class="react-left ml-4 react-l-s">
              <span class="react-left"></span>
              <span class="text">数据分析1</span>
            </div>
            <div class="react-left ml-3">
              <span class="text">数据分析2</span>
            </div>
          </div>
          <div class="d-flex aside-width">
            <div class="react-right bg-color-blue mr-3">
              <span class="text fw-b">vue-big-screen</span>
            </div>
            <div class="react-right mr-4 react-l-s">
              <span class="react-after"></span>
              <span class="text"
                >{{ dateYear }} {{ dateWeek }} {{ dateDay }}</span
              >
            </div>
          </div>
        </div>

        <!-- 第三行 -->
        <div class="content-wrapper">
          <!--第一列 -->
          <div class="column">
            <left1 class="child-25" />
            <left2 class="child-30" />
            <left3 class="child-35" />
            <left4 class="child-40" />
          </div>

          <!--第二列 -->
          <div class="column">
            <dv-border-box-12 style="height: 30%">
              <center1 />
            </dv-border-box-12>
            <dv-border-box12 style="height: 80%">
              <center-left2 />
            </dv-border-box12>
          </div>

          <!--第三列 -->
          <div class="column">
            <right1 />
            <right2 />
            <right3 />
          </div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import drawMixin from "../utils/drawMixin";
import { formatTime } from "../utils/index.js";
import centerLeft1 from "./bigScreen/centerLeft1";
import centerLeft2 from "./bigScreen/centerLeft2";
import centerRight1 from "./bigScreen/centerRight1";
import centerRight2 from "./bigScreen/centerRight2";
import center from "./bigScreen/center";
import bottomLeft from "./bigScreen/bottomLeft";
import bottomRight from "./bigScreen/bottomRight";
import Center1 from "@/views/bigScreen/center1";
import Left1 from "@/views/bigScreen/left1";
import Left2 from "@/views/bigScreen/left2";
import Left3 from "@/views/bigScreen/left3";
import Left4 from "@/views/bigScreen/left4";
import Right1 from "@/views/bigScreen/right1";
import Right2 from "@/views/bigScreen/right2";
import Right3 from "@/views/bigScreen/right3";

export default {
  mixins: [drawMixin],
  data() {
    return {
      timing: null,
      loading: true,
      dateDay: null,
      dateYear: null,
      dateWeek: null,
      weekday: ["周日", "周一", "周二", "周三", "周四", "周五", "周六"],
      decorationColor: ["#568aea", "#000000"],
    };
  },
  components: {
    Right3,
    Right2,
    Right1,
    Left4,
    Left3,
    Left2,
    Left1,
    Center1,
    Map,
    centerLeft1,
    centerLeft2,
    centerRight1,
    centerRight2,
    center,
    bottomLeft,
    bottomRight,
  },
  mounted() {
    this.timeFn();
    this.cancelLoading();
  },
  beforeDestroy() {
    clearInterval(this.timing);
  },
  methods: {
    timeFn() {
      this.timing = setInterval(() => {
        this.dateDay = formatTime(new Date(), "HH: mm: ss");
        this.dateYear = formatTime(new Date(), "yyyy-MM-dd");
        this.dateWeek = this.weekday[new Date().getDay()];
      }, 1000);
    },
    cancelLoading() {
      setTimeout(() => {
        this.loading = false;
      }, 500);
    },
  },
};
</script>

<style lang="scss" scoped>
@import "../assets/scss/index.scss";
.content-wrapper {
  display: grid;
  gap: 2%;
  grid-template-columns: repeat(3, 1fr);
}

.column {
  display: flex;
  flex-direction: column;
  gap: 2%;
  height: 930px;
}
.child-25 {
  flex: 0 0 18%; /* 不缩放，占用25%高度 */
}

.child-30 {
  flex: 0 0 25%; /* 不缩放，占用30%高度 */
}

.child-35 {
  flex: 0 0 30%; /* 不缩放，占用20%高度 */
}
.child-40 {
  flex: 0 0 25%; /* 不缩放，占用20%高度 */
}
</style>
